#include "dateinputkey.h"
#include "ui_dateinputkey.h"

DateInputKey::DateInputKey(QWidget *parent) :
    TDialog(parent),
    ui(new Ui::DateInputKey)
{
    ui->setupUi(this);
    this->setWindowTitle("");
    ui->date_k_1->setProperty("key",'1');
    ui->date_k_2->setProperty("key",'2');
    ui->date_k_3->setProperty("key",'3');
    ui->date_k_4->setProperty("key",'4');
    ui->date_k_5->setProperty("key",'5');
    ui->date_k_6->setProperty("key",'6');
    ui->date_k_7->setProperty("key",'7');
    ui->date_k_8->setProperty("key",'8');
    ui->date_k_9->setProperty("key",'9');
    ui->date_k_0->setProperty("key",'0');
    ui->date_k_ce->setProperty("key",'\b');
    ui->date_k_enter->setProperty("key",'\r');

    connect(ui->date_k_1,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_2,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_3,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_4,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_5,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_6,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_7,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_8,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_9,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_0,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_ce,SIGNAL(clicked()),this,SLOT(clickBtn()));
    connect(ui->date_k_enter,SIGNAL(clicked()),this,SLOT(clickBtn()));


}


void DateInputKey::clickBtn()
{
    QPushButton *button = qobject_cast<QPushButton *>(sender());
    if (button)
    {
       numkeyClicked(button->property("key").toChar());
    }
}


DateInputKey::~DateInputKey()
{
    delete ui;
}
